Additive schedule registration for TypeScript for file-splitting#5435
Conversation
|
For context, the solution that @coolreader18 and I discussed was to allow you to specify on the reducer, the table you wanted to schedule to. The one detail is that we would need to enforce (at least for now), that at most (and perhaps exactly) one reducer was subscribed to a schedule table. The reason being is that the calling order would not be well defined, and we didn't want people to rely on whatever order we end up calling them in. So that would look like this: const scheduledMessages = table({public: true}, {
scheduledId: t.u64().primaryKey().autoInc(),
scheduledAt: t.scheduleAt(),
text: t.string(),
});
const spacetimedb = schema({ scheduledMessages });
spacetime.reducer({ on_schedule = spacetimedb.scheduledMessages });
// or something similarThe idea was that it would align with the future reactive reducers envisioned in: https://github.com/clockworklabs/SpacetimeDBPrivate/pull/2862 This change would also be an additive change. Also please add any new syntax we go with to the |
I've completely refactored the PR to move in this direction as I did go with |
|
|
cloutiertyler
left a comment
There was a problem hiding this comment.
This now LGTM but with an important comment about module-test-ts that I'd like to address.
Closes: #4571 - The secondary issue specifically
Description of Changes
onScheduleoptional parameter forreducersandproceduresas suggested by @cloutiertyler to move towards reactive reducersreducer/procedureper schedule tabletable({ scheduled })path workingScheduleAtcolumn tracking onto table metadataschedule.scheduleAtColfor compatibilityOther Options Considered
.schedule()scheduled: 'reducerName'string/name intable(...)API and ABI breaking changes
.reducer()and.procedure()foronScheduletable({ scheduled })behaviorExpected complexity level and risk
3 - Preserving legacy scheduled table behavior while changing how schedule metadata is assembled
Testing